home *** CD-ROM | disk | FTP | other *** search
/ CICA 1995 August / CICA - The Ultimate Collection of Shareware for Windows (Disc 2) (August 1995).iso / disc2 / demo / pwrtcp11.exe / SETUP.MS_ / SETUP.bin
Text File  |  1995-03-02  |  11KB  |  296 lines

  1. '**************************************************************************
  2. '*                       PowerTCP Setup
  3. '**************************************************************************
  4.  
  5. ''$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. ''Dialog ID's
  11. CONST WELCOME       = 100
  12. CONST ASKQUIT       = 200
  13. CONST DESTPATH      = 300
  14. CONST LICENSE       = 301
  15. CONST EXITFAILURE   = 400
  16. CONST EXITQUIT      = 600
  17. CONST EXITSUCCESS   = 700
  18. CONST OPTIONS       = 800
  19. CONST APPHELP       = 900
  20. CONST BILLBOARD     = 5000
  21. CONST BADPATH       = 6400
  22.  
  23. ''Bitmap ID
  24. CONST LOGO = 1
  25.  
  26.  
  27. GLOBAL DEST$        ''Default destination directory.
  28. GLOBAL OPTCUR$      ''Option selection from option dialog.
  29.  
  30. DECLARE SUB Install
  31. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  32.  
  33. DECLARE FUNCTION Ctl3dAutoSubClass Lib "Ctl3d.dll" (hInst AS INTEGER) AS INTEGER
  34. DECLARE FUNCTION Ctl3dRegister Lib "Ctl3d.dll" (hInst AS INTEGER) AS INTEGER
  35. DECLARE FUNCTION Ctl3dUnRegister Lib "Ctl3d.dll" (hInst AS INTEGER) AS INTEGER
  36. DECLARE FUNCTION ShowWindow Lib "User" (hWnd AS INTEGER, nCmdShow AS INTEGER) AS INTEGER
  37. CONST SW_SHOWMAXIMIZED = 3
  38.  
  39.  
  40.  
  41. INIT:
  42.     suc% = ShowWindow(HWndFrame(), SW_SHOWMAXIMIZED) 
  43.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  44.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  45.  
  46.     ret% = Ctl3dRegister(HinstFrame())
  47.     ret% = Ctl3dAutoSubClass(HinstFrame())
  48.  
  49.     SetBitmap CUIDLL$, LOGO
  50.     SetTitle "PowerTCP Setup"
  51.     SetAbout "PowerTCP", "Version 1.1 Copyright ⌐ 1994 Dart Communications"
  52.     ret% = SetBeepingMode(1)
  53.  
  54.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  55.     IF szInf$ = "" THEN
  56.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  57.     END IF
  58.     ReadInfFile szInf$
  59.  
  60.     OPTCUR$ = "1"
  61.     DEST$ = "C:\POWERTCP"
  62.  
  63. '$IFDEF DEBUG
  64.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  65.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  66.     IF IsDriveValid(WinDrive$) = 0 THEN
  67.         i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  68.         GOTO QUIT
  69.     END IF
  70. '$ENDIF ''DEBUG
  71.  
  72.  
  73. WELCOME:
  74.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  75.     IF sz$ = "CONTINUE" THEN
  76.         UIPop 1
  77.     ELSE
  78.         GOSUB ASKQUIT
  79.         GOTO WELCOME
  80.     END IF
  81.  
  82. GETPATH:
  83.     SetSymbolValue "EditTextIn", DEST$
  84.     SetSymbolValue "EditFocus", "END"
  85. GETPATHL1:
  86.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  87.     DEST$ = GetSymbolValue("EditTextOut")
  88.  
  89.     IF sz$ = "CONTINUE" THEN
  90.         IF IsDirWritable(DEST$) = 0 THEN
  91.             GOSUB BADPATH
  92.             GOTO GETPATHL1
  93.         END IF
  94.         UIPop 1
  95.     ELSEIF sz$ = "REACTIVATE" THEN
  96.         GOTO GETPATHL1
  97.     ELSEIF sz$ = "BACK" THEN
  98.         UIPop 1
  99.         GOTO WELCOME
  100.     ELSE
  101.         GOSUB ASKQUIT
  102.         GOTO GETPATH
  103.     END IF
  104.  
  105.  
  106. OPTION:
  107.     '' SetSymbolValue "RadioDefault", OPTCUR$
  108. OPTL1:
  109.     sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", APPHELP, HELPPROC$)
  110.     OPTCUR$ = GetSymbolValue("ButtonChecked")
  111.  
  112.     IF sz$ = "CONTINUE" THEN
  113.         UIPop(1)
  114.     ELSEIF sz$ = "REACTIVATE" THEN
  115.         GOTO OPTL1
  116.     ELSE
  117.         GOSUB ASKQUIT
  118.         GOTO OPTION
  119.     END IF
  120.  
  121.  
  122.     AddToBillboardList CUIDLL$, BILLBOARD, "FModelessDlgProc", 1
  123.     SetCopyGaugePosition 160, 170
  124.     
  125.     Install
  126.  
  127.  
  128.     IF OPTCUR$ = "2" THEN
  129.         i% = DoMsgBox("Be sure to modify your autoexec.bat file to include " + MakePath(DEST$,"BIN") + " in your path statement.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  130.     END IF
  131.  
  132.     
  133. QUIT:
  134.     ON ERROR GOTO ERRQUIT
  135.  
  136.     IF ERR = 0 THEN
  137.         dlg% = EXITSUCCESS
  138.     ELSEIF ERR = STFQUIT THEN
  139.         dlg% = EXITQUIT
  140.     ELSE
  141.         dlg% = EXITFAILURE
  142.     END IF
  143. QUITL1:
  144.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  145.     IF sz$ = "REACTIVATE" THEN
  146.         GOTO QUITL1
  147.     END IF
  148.     UIPop 1
  149.  
  150.     ret% = Ctl3dUnRegister(HinstFrame())
  151.     
  152.     END
  153.  
  154. ERRQUIT:
  155.     i% = DoMsgBox("Setup sources were corrupted, call (315) 655-1024!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  156.  
  157.     ret% = Ctl3dUnRegister(HinstFrame())
  158.  
  159.     END
  160.  
  161.  
  162.  
  163. BADPATH:
  164.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  165.     IF sz$ = "REACTIVATE" THEN
  166.         GOTO BADPATH
  167.     END IF
  168.     UIPop 1
  169.     RETURN
  170.  
  171.  
  172.  
  173. ASKQUIT:
  174.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  175.  
  176.     IF sz$ = "EXIT" THEN
  177.         UIPopAll
  178.         ERROR STFQUIT
  179.     ELSEIF sz$ = "REACTIVATE" THEN
  180.         GOTO ASKQUIT
  181.     ELSE
  182.         UIPop 1
  183.     END IF
  184.     RETURN
  185.  
  186.  
  187.  
  188. '**
  189. '** Purpose:
  190. '**     Builds the copy list and performs all installation operations.
  191. '** Arguments:
  192. '**     none.
  193. '** Returns:
  194. '**     none.
  195. '*************************************************************************
  196. SUB Install STATIC
  197.     
  198.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  199.     CreateDir DEST$, cmoNone
  200.     CreateDir MakePath(DEST$,"bin"), cmoNone
  201.     CreateDir MakePath(DEST$,"include"), cmoNone
  202.     CreateDir MakePath(DEST$,"lib"), cmoNone
  203.     CreateDir MakePath(DEST$,"samples"), cmoNone
  204.     CreateDir MakePath(DEST$,"samples\c_echo"), cmoNone
  205.     CreateDir MakePath(DEST$,"samples\c_telnet"), cmoNone
  206.     CreateDir MakePath(DEST$,"samples\c_ftp"), cmoNone
  207.     CreateDir MakePath(DEST$,"samples\vb_talk"), cmoNone
  208.     CreateDir MakePath(DEST$,"samples\vb_tcpex"), cmoNone
  209.     CreateDir MakePath(DEST$,"samples\vb_vt220"), cmoNone
  210.     CreateDir MakePath(DEST$,"samples\vb_tntex"), cmoNone
  211.     CreateDir MakePath(DEST$,"samples\vb_ftp"), cmoNone
  212.  
  213.     OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
  214.     WriteToLogFile ""
  215.     WriteToLogFile "  User chose as destination directory: '" + DEST$ + "'"
  216.     WriteToLogFile "  User chose option: '" + OPTCUR$ + "'"
  217.     WriteToLogFile ""
  218.     WriteToLogFile "May have had to create the directory: " + DEST$
  219.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"bin")
  220.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"include")
  221.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"lib")
  222.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"samples")
  223.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"samples\c_dg")
  224.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"samples\c_echo")
  225.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"samples\c_telnet")
  226.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"samples\c_ftp")
  227.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"samples\vb_dg") 
  228.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"samples\vb_talk") 
  229.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"samples\vb_tcpex") 
  230.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"samples\vb_vt220") 
  231.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"samples\vb_tntex")
  232.     WriteToLogFile "May have had to create the directory: " + MakePath(DEST$,"samples\vb_ftp")
  233.     WriteToLogFile ""
  234.  
  235.     SELECT CASE OPTCUR$
  236.     CASE "1"
  237.         AddSectionFilesToCopyList "binFiles", SrcDir$, GetWindowsSysDir()
  238.     CASE "2"
  239.         AddSectionFilesToCopyList "binFiles", SrcDir$, MakePath(DEST$,"bin")
  240.     END SELECT
  241.     AddSectionFilesToCopyList "rootFiles", SrcDir$, DEST$
  242.     AddSectionFilesToCopyList "includeFiles", SrcDir$, MakePath(DEST$,"include")
  243.     AddSectionFilesToCopyList "libFiles", SrcDir$, MakePath(DEST$,"lib")
  244.     AddSectionFilesToCopyList "c_dgFiles", SrcDir$, MakePath(DEST$,"samples\c_dg")
  245.     AddSectionFilesToCopyList "c_echoFiles", SrcDir$, MakePath(DEST$,"samples\c_echo")
  246.     AddSectionFilesToCopyList "c_telnetFiles", SrcDir$, MakePath(DEST$,"samples\c_telnet")
  247.     AddSectionFilesToCopyList "c_ftpFiles", SrcDir$, MakePath(DEST$,"samples\c_ftp")
  248.     AddSectionFilesToCopyList "vb_dgFiles", SrcDir$, MakePath(DEST$,"samples\vb_dg")
  249.     AddSectionFilesToCopyList "vb_talkFiles", SrcDir$, MakePath(DEST$,"samples\vb_talk")
  250.     AddSectionFilesToCopyList "vb_tcpexFiles", SrcDir$, MakePath(DEST$,"samples\vb_tcpex")
  251.     AddSectionFilesToCopyList "vb_vt220Files", SrcDir$, MakePath(DEST$,"samples\vb_vt220")
  252.     AddSectionFilesToCopyList "vb_tntexFiles", SrcDir$, MakePath(DEST$,"samples\vb_tntex")
  253.     AddSectionFilesToCopyList "vb_ftpFiles", SrcDir$, MakePath(DEST$,"samples\vb_ftp")
  254.     CopyFilesInCopyList
  255.  
  256.     CreateProgmanGroup "PowerTCP Demo Toolkit", "", cmoNone
  257.     ShowProgmanGroup  "PowerTCP Demo Toolkit", 1, cmoNone
  258.     CreateProgmanItem "PowerTCP Demo Toolkit", "Read Me", MakePath(DEST$,"readme.hlp"), "", cmoOverwrite
  259.     CreateProgmanItem "PowerTCP Demo Toolkit", "C Datagram Sample", MakePath(DEST$,"samples\c_dg\dg16c.exe"), "", cmoOverwrite 
  260.     CreateProgmanItem "PowerTCP Demo Toolkit", "C++ Telnet Sample", MakePath(DEST$,"samples\c_telnet\tnt16cpp.exe"), "", cmoOverwrite 
  261.     CreateProgmanItem "PowerTCP Demo Toolkit", "C Echo Sample", MakePath(DEST$,"samples\c_echo\echo16c.exe"), "", cmoOverwrite 
  262.     CreateProgmanItem "PowerTCP Demo Toolkit", "VT-220 Telnet Client Sample", MakePath(DEST$,"samples\vb_vt220\vt220.exe"), "", cmoOverwrite
  263.     CreateProgmanItem "PowerTCP Demo Toolkit", "C FTP Sample", MakePath(DEST$,"samples\c_ftp\ftpc.exe"), "", cmoOverwrite 
  264.     CreateProgmanItem "PowerTCP Demo Toolkit", "VB Datagram Sample", MakePath(DEST$,"samples\vb_dg\udp.exe"), "", cmoOverwrite
  265.     CreateProgmanItem "PowerTCP Demo Toolkit", "VB Talk Sample", MakePath(DEST$,"samples\vb_talk\talk.exe"), "", cmoOverwrite
  266.     CreateProgmanItem "PowerTCP Demo Toolkit", "VB Telnet Sample", MakePath(DEST$,"samples\vb_tntex\telnetex.exe"), "", cmoOverwrite
  267.     CreateProgmanItem "PowerTCP Demo Toolkit", "VB TCP Sample", MakePath(DEST$,"samples\vb_tcpex\tcpex.exe"), "", cmoOverwrite
  268.     CreateProgmanItem "PowerTCP Demo Toolkit", "VB FTP Sample", MakePath(DEST$,"samples\vb_ftp\ftp.exe"), "", cmoOverwrite
  269.  
  270.     CloseLogFile
  271.  
  272. END SUB
  273.  
  274.  
  275.  
  276. '**
  277. '** Purpose:
  278. '**     Appends a file name to the end of a directory path,
  279. '**     inserting a backslash character as needed.
  280. '** Arguments:
  281. '**     szDir$  - full directory path (with optional ending "\")
  282. '**     szFile$ - filename to append to directory
  283. '** Returns:
  284. '**     Resulting fully qualified path name.
  285. '*************************************************************************
  286. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  287.     IF szDir$ = "" THEN
  288.         MakePath = szFile$
  289.     ELSEIF szFile$ = "" THEN
  290.         MakePath = szDir$
  291.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  292.         MakePath = szDir$ + szFile$
  293.     ELSE
  294.         MakePath = szDir$ + "\" + szFile$
  295.     END IF
  296. END FUNCTION